Welcome
Guest
, you are in:
<root>
Elements
•
Login
EventIDE Wiki
Navigation
¶
Main Page
Random Page
Create a new Page
All Pages
Categories
Navigation Paths
Administration
File Management
Create Account
Search the wiki
Back
Built-in data types
Modified on 2014/05/30 16:15
by
Administrator
Categorized as
Programming
{s:Conceptual Object Panel | title=Custom data types | category=Programming | | icon= } EventIDE provides several built-in data types that are used for element [properties]. The built-in types are also available for coding in the snippets and developing the custom AddIns. The built-in types are not classes but [^http://msdn.microsoft.com/en-us/library/34yytbws%28v=vs.71%29.aspx|.NET values types] - it means they can be declared and assigned directly, like the standard Int32 and Double types. On this page all built-in EventIDE types are listed with complete descriptions and code examples. {TOC} ==<A Name="stColor"> stColor type == stColor is a data type for managing colors in EventIDE. stColor is a [^http://msdn.microsoft.com/en-us/library/ah19swz4%28v=VS.71%29.aspx|data struct] that stores a single 32-bits ARGB value internally. stColor type supports [http://msdn.microsoft.com/en-us/library/z5z9kes2.aspx|implicit conversions] to other color type === Fields === stColor struct contains the following fields: {| |- ! Field Name ! Description ! Value Type |- | .A | Defines a value for the Alpha channel (transparency). The valid range is 0..255. | Int32 |- | .R | Defines a value for the Red channel. The valid range is 0..255. | Int32 |- | .G | Defines a value for the Green channel. The valid range is 0..255. | Int32 |- | .B | Defines a value for the Blue channel. The valid range is 0..255. | Int32 |- | .Hue | Defines the color hue in [^http://en.wikipedia.org/wiki/HSL_and_HSV|HSB/HSV color space]. The value has to be in the range 0..360. If the Saturation and Brightness have extreme values(e.g. 0 or 100) changes in the Hue field are ignored | Double |- | .Saturation | Defines the color saturation in [^http://en.wikipedia.org/wiki/HSL_and_HSV|HSB/HSV color space] The value has to be in the range 0..100 | Double |- | .Brightness | Defines the color saturation in [^http://en.wikipedia.org/wiki/HSL_and_HSV|HSB/HSV color space] The value has to be in the range 0..100 | Double |- | .Color | Represents the current value as [^http://msdn.microsoft.com/en-us/library/system.windows.media.color.aspx|System.Windows.Media.Color] type | System.Windows.Media.Color |- | .GDIColor | Represents the current value as [^http://msdn.microsoft.com/en-us/library/ms533798%28v=vs.85%29.aspx|GDI+][^http://msdn.microsoft.com/en-us/library/system.drawing.color.aspx|System.Drawing.Color] type | System.Drawing.Color |} === GUI type editor === stColor data type underlies a majority of color properties in EventIDE objects. The program provides an dedicated editor for stColor values. {| |- | [imageleft|Screenshot of the stColor GUI editor|{UP}/pictures/PropertyEditors/ColorEditor.png] |} === Code examples === @@ csharp // Implicit conversions for stColor type MyColor=Color.Red; MyColor="Blue"; MyColor="#FF00FF00"; // Declaration and initialization // declare a new stColor and initialize its value to the green stColor MyColor=new stColor(); MyColor.A=255; MyColor.R=0; MyColor.G=255; MyColor.B=0; // declare and initialize with the green color with an optional stColor constructors stColor MyColor2=new stColor(0,255,0); stColor MyColor3=new stColor(255,0,255,0); // declare and initialize the blue color with functions and constants of GDI+ API stColor MyColor3.GDIColor=Color.FromArgb(255,0,0,255); stColor MyColor4.GDIColor=Color.Blue; @@ @@ csharp // using stColor type in GDI+ drawing procedures stColor RedColor=new stColor(127,0,0); Pen BluePen = new Pen(RedColor.GDIColor, 3); Graphics.DrawRectangle(BluePen, 0,0,50,50); @@ @@ csharp // Internal fields the stColor type BackgroundColor=new stColor(255,255,255); // set the event background to white TextColor.R=127; TextColor.G=127; TextColor.B=127; // set the font color of the Text Element to the mid-gray @@ @@ csharp // The following examples cause runtime errors because the field values have to be integers in the range 0..255 stColor MyColor=new stColor(0,256,0); stColor MyColor2; MyColor2.R=-20; @@ ==<A Name="clTime"> clTime type== clTime is a data type that represents a time interval in EventIDE. Most of the timing properties, such as Duration, Elapsed Time, has this type. The type value stores a length of the time interval in milliseconds, including the sub-millisecond fraction. clTime supports implicit conversions to all numerical types. @@ csharp // Assigning clTime type with implicit conversions int TimeA=2000; double TimeB=1000.5; EventA_Duration=TimeA; // the time interval is assigned with integer value EventB_Duration=TimeB; // the time interval is assigned with double precision EventC_Duration=500.5; // the time interval is assigned directly int TimeC=EventC_Duration; // TimeC contains 501 due to rounding @@ ==<A Name="clPoint"> clPoint type== clPoint is a data type for managing screen positions in EventIDE. clPoint is a [^http://msdn.microsoft.com/en-us/library/ah19swz4%28v=VS.71%29.aspx|data struct] that stores a 2D screen position and represents it both in cartesian (units: pixels) and polar coordinates (units: visual and angular degrees). The conversion between pixels and visual degrees values is calculated according to the current screen settings of the experiment. === Fields === clPoint struct contains the following fields: {| |- ! Field Name ! Description ! Value Type |- | .X | Defines the X-Axis value (in pixels) relatively to left-top corner of the screen(). | Int32 |- | .Y | Defines the Y-Axis value (in pixels) relatively to left-top corner of the screen. | Int32 |- | .R | Defines a distance (in visual degrees) between the given point and the screen center,as the radius in [^http://en.wikipedia.org/wiki/Polar_coordinate_system|the polar coordinate system]. The exact pixels/visual degree conversion depends on chosen screen settings for each experiment. | float/Single |- | .Theta | Defines a polar angle (in degrees) to the given point from the screen center, as azimuth in [^http://en.wikipedia.org/wiki/Polar_coordinate_system|the polar coordinate system]. The angles (0..360) are counted from the right arm of the horizontal axis in the anticlockwise direction. | float/Single |- | .IsNotDefined | For internal use. If true, indicates an invalid screen point. The fields of the invalid screen point can not be accessed. | boolean |} === GUI type editor === clPoint data type underlies a majority of coordinates properties in EventIDE objects. The program provides an dedicated editor for clPoint values. {| |- | [imageleft|Screenshot of the clPoint GUI editor|{UP}/pictures/PropertyEditors/PointEditor.png] |} @@ csharp // declare and initialize clPoint type clPoint MyPoint=new clPoint(); // the point is declared and initialized. The point is valid. clPoint MyPoint2=new clPoint(100,100); // the point is declared and initialized with particular pixel coordinates clPoint MyPoint3=new clPoint(4.0f,45.0f); // the point is declared and initialized with the polar coordinates 4,45 @@ @@ csharp // Pixel fields of clPoint type Position=new clPoint(512,368); // Initialize with pixels coordinates Position.X=512; Position.Y=368; // set the position to the screen center @@ @@ csharp // Polar fields of of clPoint type Position=new clPoint(5.0f,90.0f); // Initialize with polar coordinates // set the position of Text Element on 5 visual degree up from the screen center (in any screen resolution) TextPosition.R=5; TextPosition.Theta=90; @@ ==<A Name="clSize"> clSize type == clSize is a data type for managing screen sizes in EventIDE. clSize is a struct that stores a size of 2D area and represents it both in screen pixels and visual degrees. The conversion between pixels and visual degrees is calculated according to the current screen settings of the experiment. === Fields === clPoint struct contains the following fields: {| |- ! Field Name ! Description ! Value Type |- | .Width | Defines the width in pixels. | Int32 |- | .Height | Defines the height in pixels. | Int32 |- | .aWidth | Defines the width in visual degrees. | float/Single |- | .aHeight | Defines the height in visual degrees. | float/Single |- | .IsProportional | If true, any change in the width or height is accompanied by a automatic change in the second dimension such that the whole area keeps its proportions. | boolean |} === GUI type editor === clSize data type underlies a majority of size related properties in EventIDE objects. The program provides an dedicated editor for clSize values. {| |- | [imageleft|Screenshot of the clSize GUI editor|{UP}/pictures/PropertyEditors/SizeEditor.png] |} @@ csharp // declare and initialize clPoint type clSize MySize=new clSize(); // the size is declared and initialized with zero values. clSize MySize2=new clSize(320,200); // the size is declared and initialized with specific pixel size clSize MySize3=new clSize(5.0f,2.0f); // the size is declared and initialized with specific size in visual degrees @@ @@ csharp // Change values of proxy variables (Size and TextAreaSize) of clSize type Size=new clSize(200,80); // set the size of Renderer element to 200x80 pixels TextAreaSize.aWidth=5.5f; TextAreaSize.aHeight=2.1f; // set the size of Text Element on 5.5x2.1 visual degrees @@ ==<A Name="clMIDINote"> clMIDINote type == clMIDINote is a struct data type for storing the single note information recorded by the [MIDI-Input-element|MIDI-Input-element]. This type is read-only, writing to its struct fields has no effect. === Fields === clMIDINote struct contains the following fields: {| |- ! Field Name ! Description ! Value Type |- | .MIDIChannel | Returns the zero-based index of MIDI channel that produced the given note | System.Int32 |- | .Note | Returns a conventional name of the note | System.Int32 |- | .Octave | Returns an octave index of the note in the negative to positive range | System.Int32 |- | .StartTime | Returns a timestamp of the note measured in elapsed ms. since the onset of the parent event | [#clTime] |- | .Duration | Returns a duration of the note in ms. as measured by the application. | [#clTime] |- | .Velocity | Returns a press velocity (or volume) of the note | System.Int32 |- | .Frequency | Returns the physical sound frequency (in Hz) of the note | System.Double |} ==<A Name="clMIDIEvent"> clMIDIEvent type == clMIDIEvent is a struct data type for storing information about a single low-level MIDI event recorded by the [MIDI-Input-element|MIDI-Input-element]. This type is read-only, writing to its struct fields has no effect. === Fields === clMIDIEvent struct contains the following fields: {| |- ! Field Name ! Description ! Value Type |- | .Name | Returns a name of the MIDI event | System.String |- | .Time | Returns a timestamp of the event measured in elapsed ms. since the onset of the parent event | [#clTime] |- | .Data1 | Returns the first part of event data. For the NoteOn events this field contains MIDI button code. | System.Int32 |- | .Data2 | Returns the second part of event data. For the 'NoteOn' events this field contains the pressing velocity, for the 'NoteOff' events the value is zero. | System.Int32 |- | .MIDIChannel | Returns the zero-based index of MIDI channel that produced the given event | System.Int32 |} == Enum Types == Built-in enum data types in EventIDE are distinct types consisting of sets of named constants called the enumerator lists. Each types has its own enumeration list and type value represents an zero-cased index of the selected item in that list. Thus, a value of the enum data type can be assigned with integer value from 0 (for the first item) to N-1 (for the last item). ===<A Name="stAlignment"> stAlignment === stAlignment is used to align the Position property and rotation center of a visual element relatively to its own rendering area. By default, the Position property corresponds to the center of the rendering area. stAlignment enum contains the following items: {| |- ! Index ! Item Name ! Description |- | 0 | Left-top | Position is aligned to the left-top corner of the rendering area |- | 1 | Center | Position is aligned to the center of the rendering area |- | 2 | Right-top | Position is aligned to the right-top corner of the rendering area |- | 3 | Right-bottom | Position is aligned to the right-bottom corner of the rendering area |- | 4 | Left-bottom | Position is aligned to the left-bottom corner of the rendering area |} @@ csharp // Change values of proxy variables (RendererAlignment) of stAlignment type RendererAlignment=0; /// change the position alignment to the left-top corner @@ == Final Notes ==
Meta Keywords:
Meta Description:
Change Comment:
ScrewTurn Wiki
version 5.2.0.8. Some of the icons created by
FamFamFam
.